package com.dodock.survey;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import android.util.Log;

import com.dodock.survey.baseclasses.Information;
import com.dodock.survey.db.DatabaseManager;

public class Brave {
	
	private static String filePath;
	private static DatabaseManager db;
	
	public static String ID_value = "";
	public static int D4_value = 0;
	
	public static ArrayList<Information> infoList;
	public static String USER_NAME = "";
	
	public static String SEED = "brave_2345asdcvb";
	
	public static void setFilePath(String path) {
		filePath = path;
	}
	
	private static String externalSdCardPath;
	
	
	public static String getExternalSdCardPath() {
		return externalSdCardPath;
	}
	public static void setExternalSdCardPath(String externalSdCardPath) {
		Brave.externalSdCardPath = externalSdCardPath;
	}
	public static String getFilePath() {
		return filePath;
	}
	public static DatabaseManager getDatabaseManager() {
		return db;
	}
	public static void setDatabaseManager(DatabaseManager dbm) {
		db = dbm;
	}
	
	public static String decryptStringAndReturnString(String encryptedValue){
		String decryptedValue = "";
		try{
			decryptedValue = SimpleCrypto.decrypt(SEED, encryptedValue);
		}catch(Exception ex){}
		return decryptedValue;
	}
	
	public static int decryptStringAndReturnInt(String encryptedValue){
		int decryptedValue = 0;
		try{
			String value = SimpleCrypto.decrypt(SEED, encryptedValue);
			decryptedValue = Integer.parseInt(value);		
		}catch(Exception ex){}
		return decryptedValue;
	}

	
	public static String encryptString(String encryptedValue){
		String encryptedString = "";
		try{
			encryptedString = SimpleCrypto.encrypt(SEED, encryptedValue);
		}catch(Exception ex){}
		return encryptedString;
	}
	
	public static String encryptInteger(int planeInt){
		String encryptedString = "";
		try{
			String value = String.valueOf(planeInt);
			encryptedString = SimpleCrypto.encrypt(SEED, value);
		}catch(Exception ex){}
		return encryptedString;
	}
	
	public static String getCurrentTimeStamp() {
	    SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss.SSS");
	    Date now = new Date();
	    String strDate = sdfDate.format(now);
	    return strDate;
	}
}
